package com.example.icongyou.bean;

import java.util.Date;

public class AssignmentDisplay {
    private Long id;
    private Long teamId;
    private Long submittedBy;
    private Double score;
    private Date submittedAt;
    private Date createdAt;
    private Integer isExcellent;
    private String courseId;

    // 显示用的字段
    private String teamName;
    private String studentName;
    private String courseName;
    private String courseDescription;

    public AssignmentDisplay() {}

    // Getter和Setter方法
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }

    public Long getTeamId() { return teamId; }
    public void setTeamId(Long teamId) { this.teamId = teamId; }

    public Long getSubmittedBy() { return submittedBy; }
    public void setSubmittedBy(Long submittedBy) { this.submittedBy = submittedBy; }

    public Double getScore() { return score; }
    public void setScore(Double score) { this.score = score; }

    public Date getSubmittedAt() { return submittedAt; }
    public void setSubmittedAt(Date submittedAt) { this.submittedAt = submittedAt; }

    public Date getCreatedAt() { return createdAt; }
    public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; }

    public Integer getIsExcellent() { return isExcellent; }
    public void setIsExcellent(Integer isExcellent) { this.isExcellent = isExcellent; }

    public String getCourseId() { return courseId; }
    public void setCourseId(String courseId) { this.courseId = courseId; }

    public String getTeamName() {
        if (teamName == null) {
            return "第" + (teamId != null ? teamId : "未知") + "组";
        }
        return teamName;
    }
    public void setTeamName(String teamName) { this.teamName = teamName; }

    public String getStudentName() {
        if (studentName == null) {
            return "学生" + (submittedBy != null ? submittedBy : "未知");
        }
        return studentName;
    }
    public void setStudentName(String studentName) { this.studentName = studentName; }

    public String getCourseName() {
        if (courseName == null) {
            return "项目实践课程";
        }
        return courseName;
    }
    public void setCourseName(String courseName) { this.courseName = courseName; }

    public String getCourseDescription() {
        if (courseDescription == null) {
            return "完成一个完整的Python程序";
        }
        return courseDescription;
    }
    public void setCourseDescription(String courseDescription) { this.courseDescription = courseDescription; }

    // 获取显示名称：小组-人名
    public String getDisplayName() {
        return getTeamName() + "-" + getStudentName();
    }

    // 获取状态文本
    public String getStatusText() {
        if (score == null || score == 0.0) {
            return "未审核";
        } else {
            return String.format("%.1f分", score);
        }
    }

    // 获取状态颜色
    public int getStatusColor() {
        if (score == null || score == 0.0) {
            return 0xFFFF9800; // 橙色-未审核
        } else {
            return 0xFF4CAF50; // 绿色-已评分
        }
    }

    // 判断是否优秀
    public boolean isExcellent() {
        return isExcellent != null && isExcellent == 1;
    }
}